import { createRouter, createWebHashHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'

const routes = [
  {
    path: '/home',
    name: 'home',
    component: HomeView,
    children:[
      {
        path: '/profile',
        name: 'profile',
        component: () => import( '../views/profile.vue')
      },
      {
        path: '/chart',
        name: 'chart',
        component: () => import( '../views/chart.vue')
      },
      {
        path: '/create',
        name: 'create',
        component: () => import( '../views/article/create.vue')
      },
      {
        path: '/ranking',
        name: 'ranking',
        component: () => import( '../views/article/ranking.vue')
      },
      {
        path: '/manage',
        name: 'manage',
        component: () => import( '../views/user/manage.vue')
      },
      {
        path: '/permission',
        name: 'permission',
        component: () => import( '../views/user/permission.vue')
      },
      {
        path: '/role',
        name: 'role',
        component: () => import( '../views/user/role.vue')
      },
    ]
  },
  {
    path: '/about',
    name: 'about',
    component: () => import( '../views/AboutView.vue')
  },
  {
    path: '/',
    name: 'login',
    component: () => import( '../views/login.vue')
  },

]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
